#include "joinroom.h"
#include "ui_joinroom.h"
#include <QStyle>
#include <QScreen>
#include <QMessageBox>

Joinroom::Joinroom(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Joinroom)
{
    ui->setupUi(this);
}

Joinroom::~Joinroom() {
    delete ui;
}

void Joinroom::showEvent(QShowEvent *event)
{
    setGeometry(
        QStyle::alignedRect(
            Qt::LeftToRight,
            Qt::AlignCenter,
            size(),
            QApplication::primaryScreen()->availableGeometry()
        )
    );
    QWidget::showEvent(event);
}


//在加入房间的页面点击加入按钮
void Joinroom::on_pushButton_clicked()
{
    QString text = ui->lineEdit->text().trimmed();
    if (!text.isEmpty()) {
        emit inputConfirmed(text.toUInt());
    }

}

void Joinroom::on_pushButton_2_clicked()
{
    emit backToMainClicked();
}
